﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using com.google.zxing.qrcode;
using com.google.zxing.common;
using com.google.zxing;
using Microsoft.Xna.Framework.Graphics;

namespace Spinning.Spinning.Entity
{
    class QRSprite : Sprite
    {
        public QRSprite(String content, Point size) 
        {
            QRCodeWriter _writer = new QRCodeWriter();
            ByteMatrix byteMatrixQR = _writer.encode(content, BarcodeFormat.QR_CODE, size.X, size.Y);
            ConvertMatrixToArray cmta = new ConvertMatrixToArray();
            Color[] colorData = cmta.doConvert(byteMatrixQR);
            _texture = new Texture2D(Game1.graphicsDevice, byteMatrixQR.Width, byteMatrixQR.Height);
            _texture.SetData(colorData);
        }
    }
}
